import Vue from 'vue';
import VueRouter from 'vue-router';

import { RouterMap } from '../utils/constants';

import UserLayout from '../views/user/Layout.vue';
import Home from '../views/user/Home.vue';
import Register from '../views/user/Register.vue';
import Goods from '../views/user/Goods.vue';
import Detail from '../views/user/Detail.vue';
import News from '../views/user/News.vue';
import Cart from '../views/user/Cart.vue'
import Order from '../views/user/Order.vue'
import Pay from '../views/user/Pay.vue'
import Center from '../views/user/Center.vue'

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    component: UserLayout,
    children: [
      {
        path: '/',
        name: RouterMap.Home,
        component: Home,
      },
      {
        path: '/register',
        name: RouterMap.Register,
        component: Register,
      },
      {
        path: '/goods',
        name: RouterMap.Goods,
        component: Goods,
      },
      {
        path: '/detail',
        name: RouterMap.Detail,
        component: Detail,
      },
      {
        path: '/news',
        name: RouterMap.News,
        component: News,
      },
      {
        path: '/cart',
        name: RouterMap.Cart,
        component: Cart,
      },
      {
        path: '/order',
        name: RouterMap.Order,
        component: Order,
      },
      {
        path: '/pay',
        name: RouterMap.Pay,
        component: Pay,
      },
      {
        path: '/center',
        name: RouterMap.Center,
        component: Center,
      },
    ],
  },
  // {
  //   path: '/admin',
  //   component: AdminLayout,
  //   children: [
  //     {
  //       path: '/admin/goods',
  //       name: RouterMap.GoodsManage,
  //       component: GoodsManage,
  //     },
  //     {
  //       path: '/admin/order',
  //       name: RouterMap.OrderManage,
  //       component: OrderManage,
  //     },
  //     {
  //       path: '/admin/dashboard',
  //       name: RouterMap.Dashboard,
  //       component: Dashboard,
  //     },
  //   ],
  // },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
